$(function(){
	//下拉框验证
	$(".judge").on("blur",function(){

			var a = $(this);
			setTimeout(function(){verify(a)},300);

		});

	function verify(a){
		console.log(a);
		if($(a).val()==""){
				$(a).parent().parent().parent().children(".right").css("display","none");
				$(a).parent().parent().parent().children(".wrong").css("display","block");

			}else{
				console.log($(a).parent().parent().parent().children(".right"));
				$(a).parent().parent().parent().children(".right").css("display","block");
				$(a).parent().parent().parent().children(".wrong").css("display","none");
			}
	}
	//输入框验证
	$(".judge1").on("blur",function(){
			if($(this).val()==""){
				$(this).parent().children(".right").css("display","none");
				$(this).parent().children(".wrong").css("display","block");

			}else{
				$(this).parent().children(".right").css("display","block");
				$(this).parent().children(".wrong").css("display","none");
			}		
	});
	$("#submit1").click(function(){
		var state = $('input:radio[name="state"]:checked').val();
		var yesno = $('input:radio[name="yesno"]:checked').val();
	
		if(state==null){
			$(".wrong1").css("display","block")
			return false;
		}else if(yesno==null){
			$(".wrong2").css("display","block");
			return false;
		}
		else if(state==null && yesno==null){
			$(".wrong1").css("display","block")
			$(".wrong2").css("display","block")
		}
		else{
			$(".wrong2").css("display","none");
			$(".wrong1").css("display","none");
		}


		if ($('.time').is(':checked')){
   			$(".wrong3").css("display","none")
		}else{
			$(".wrong3").css("display","block")
			return false;
		}
	});

	$("#submit2").click(function(){
		var yesno2 = $('input:radio[name="yesno2"]:checked').val();
		if(yesno2==null){
			$(".wrong4").css("display","block")
			return false;
		}else{
			$(".wrong4").css("display","none");
		}
	});
});